﻿<Window x:Class="AmazonGlacierGUI.UI.Views.UploadView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib"
        xmlns:AmazonGlacier="clr-namespace:AmazonGlacierGUI.Core.Helpers.AmazonGlacier;assembly=AmazonGlacierGUI.Core"
        Title="Upload archive" Height="242" Width="506" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen" ResizeMode="CanResize" ShowInTaskbar="True">
    <Window.Resources>
        <ObjectDataProvider x:Key="regionEnum"
       MethodName="GetValues" ObjectType="{x:Type System:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="AmazonGlacier:AmazonRegionEnum"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </Window.Resources>
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition  Height="20"></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="150"></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="0" Grid.Column="0" Text="Region"></TextBlock>
                <ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding Source={StaticResource regionEnum}}"
                          SelectedItem="{Binding Region,Mode=TwoWay,ValidatesOnDataErrors=True,NotifyOnValidationError=True}"
                          ></ComboBox>
            </Grid>
            <Grid Margin="0,5,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition  Height="20"></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="150"></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="0" Grid.Column="0" Text="Vault name"></TextBlock>
                <StackPanel Grid.Row="0" Grid.Column="1"  Orientation="Horizontal">
                    <TextBox  Text="{Binding VaultName,Mode=TwoWay,ValidatesOnDataErrors=True,NotifyOnValidationError=True}" Width="150" HorizontalAlignment="Left"></TextBox>
                    <Button Content="Browse" Height="21" Width="43" Command="{Binding BrowseVaultCommand}"></Button>
                    <Button Command="{Binding CreateNewVaultCommand}" Content="Create" Height="21" Width="70" Margin="5,0,0,0" ContentStringFormat="Create" />
                </StackPanel>
            </Grid>
                     
        </StackPanel>
        <DataGrid x:Name="dg" Grid.Row="1" AutoGenerateColumns="False" ItemsSource="{Binding Files}"
                  Margin="0,5,0,0"  CanUserAddRows="False" CanUserDeleteRows="True" >
            <DataGrid.Columns>
                <DataGridTextColumn Width="200" Header="File name"  Binding="{Binding FileName,Mode=OneWay,ValidatesOnDataErrors=True,NotifyOnValidationError=True}"  IsReadOnly="True"></DataGridTextColumn>
                <DataGridTextColumn  Width="200" Header="Description"  Binding="{Binding Description,Mode=TwoWay,ValidatesOnDataErrors=True,NotifyOnValidationError=True}"></DataGridTextColumn>
                <DataGridTextColumn Header="Size" Binding="{Binding Size,Converter={StaticResource BytesToTextConverter}}" IsReadOnly="True"/>
            </DataGrid.Columns>
        </DataGrid>
        <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="150,10,0,0">
            <Button Content="Upload"  Height="22" Width="80" VerticalAlignment="Top"  HorizontalAlignment="Left" Command="{Binding UploadCommand}"></Button>
            <Button Content="Close"  Height="22" Width="80" Margin="5,0,0,0" VerticalAlignment="Top"  HorizontalAlignment="Left" Command="{Binding CloseCommand}"></Button>
        </StackPanel>

    </Grid>
</Window>
